import { useState, useEffect } from 'react'
import { StatusBar, Platform, NativeModules } from 'react-native'
const { StatusBarManager } = NativeModules
export default function useGetStatusBar() {
  const [height, setHeight] = useState(0)
  useEffect(() => {
    if (Platform.OS === 'android') {
      if (StatusBar.currentHeight) {
        setHeight(StatusBar.currentHeight)
      }
    } else {
      // setHeight(40)
      StatusBarManager.getHeight((statusBarHeight: any) => {
        setHeight(statusBarHeight.height)
      })
    }
  }, [])
  return [height]
}
